new Vue({
  el: '#app',
  data: {
    active: 3,
    user: {},
    order: {},
    data: {},
  },
   mounted () {
    this.main()
  },
  methods: {
    main() {
      $http.post('/member/api.users/getcenterinfo.html', {}).then(res => {
        let { orderStats, userInfo } = res.data
        this.order = orderStats
        this.user = userInfo
        this.data = res.data
      })
    },
    // 代理商申请
    onRegion() {
      $http.post('/member/api.users/getUserRegion', {}).then(res => {
        if (res.data.code == 0) { return this.$toast(res.data.msg) }
        window.location.href = './user_region.html'
      })
    },
    onStore() {
      $http.post('/member/api.users/getStore', {}).then(res => {
        if (res.data.code == 0) { return this.$toast(res.data.msg) }
        window.location.href = './distribution_store.html'
      })
    },
    // 门店申请
    onLogout() {
      $http.post('/api/user/logout', {}).then(res => {
        if (res.data.code != 1) { return this.$toast(res.data.msg) }

        this.$toast.success({
          message: "注销成功",
          onClose: function () { window.location.href = './login.html' }
        })
      })
    }
  }
})